package com.feicheng.lanniao.controller;


import java.time.LocalDateTime;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.lanniao.entity.House;
import com.feicheng.lanniao.entity.HouseLease;
import com.feicheng.lanniao.entity.HouseLeaseClientVo;
import com.feicheng.lanniao.result.ResultInfo;
import com.feicheng.lanniao.service.IHouseLeaseClientVoService;

/**
 * <p>
 * VIEW 前端控制器
 * </p>
 *
 * @author feichengTech
 * @since 2021-09-07
 */
@RestController
@RequestMapping("/lanniao-admin/house-lease-client-vo")
public class HouseLeaseClientVoController {
	@Autowired
	private IHouseLeaseClientVoService iHouseLeaseClientVoService;
	/**
	 * 出租列表查询
	 * @param houseLeaseId 出租价格表id
	 * @param houseAreaId 面积表id
	 * @param des 描述
	 * @param provienceId 省
	 * @param cityId 市
	 * @param reignId 区
	 * @param clientId 用户id
	 * @param currentPage 当前页
	 * @param pageSize 每页多少条
	 * @return 出租列表查询集合
	 */
	@GetMapping("/page")
	public ResultInfo getList(String des,Integer provienceId,
			   Integer cityId, Integer reignId,
			   Integer clientId, Integer leaseId, Integer houseAreaId, Integer leasePriceId,
			   String tel,
			   String wxNumber,
			   String louceng,
			   String xiaoqu,
			   String pianqu,
			   String chaoxiang,
			   String zhuangxiu,
			   Integer dianti,
			   String niandai,
			   Integer roomCount,
		    @RequestParam(defaultValue = "1") Integer currentPage,
			@RequestParam(defaultValue = "10") Integer pageSize) {
		return iHouseLeaseClientVoService.getList(des, provienceId, cityId, reignId, clientId, leaseId, houseAreaId, leasePriceId, tel, wxNumber, louceng, xiaoqu, pianqu, chaoxiang, zhuangxiu, dianti, niandai, roomCount, currentPage, pageSize);
	}
	/**
	 * 房出租详情查询
	 * @param leaseId 出租id
	 * @return 返回出租详情
	 */
	@GetMapping("/info")
	public ResultInfo findDetails(Integer leaseId) {

		return iHouseLeaseClientVoService.findDetails(leaseId);
	}
	
	/**
	 * 租房新增
	 * @param leasePrice	租金
	 * @param roomCount		户型
	 * @param area			面积
	 * @param provienceId	省ID
	 * @param cityId		市ID
	 * @param reignId		区ID
	 * @param imgUrl		封面图片
	 * @param clientId		用户iD
	 * @param pianqu		片区
	 * @param xiaoqu		小区
	 * @param zhuangxiu		装修
	 * @param chaoxiang		朝向
	 * @param dianti		有无电梯
	 * @param louceng		楼层
	 * @param tel			发布电话
	 * @param wxNumber		发布微信号
	 * @param niandai		年代
	 * @return	布尔值 true-成功 false-失败
	 */
	@PostMapping("/info")
	public ResultInfo addHouseLeaseClient(
			Integer leasePrice,   
			Integer roomCount,
			Integer area, 
			Integer provienceId, 
			Integer cityId, 
			Integer reignId, 
			String imgUrl,
			Integer clientId,
			String pianqu,
			String xiaoqu,
			String zhuangxiu,
			String chaoxiang,
			Integer dianti,
			String louceng,
			String tel,
			String wxNumber,
			String niandai
			) {
		return iHouseLeaseClientVoService.addHouseLeaseClient(
				leasePrice,roomCount,area,
				provienceId, cityId,reignId,imgUrl,
				clientId,
				pianqu,
				xiaoqu,
				zhuangxiu,
				chaoxiang,
				dianti,
				louceng,
				tel,
				wxNumber,
				niandai
				);
	}
	/**
	 * 租房更新
	 * @param houseLeaseClientVo 出租房视图对象
	 * @return 布尔值 true-成功 false-失败
	 */
	@PutMapping("/info")
	public ResultInfo updateHouseLeaseClient(HouseLeaseClientVo houseLeaseClientVo) {
		return iHouseLeaseClientVoService.updateHouseLease(houseLeaseClientVo);
	}
	/**
	 * 租房删除
	 * @param houseLease 出租房对象
	 * @return 布尔值 true-成功 false-失败
	 */
	@DeleteMapping("/info")
	public ResultInfo deleteHouseLeaseClient(HouseLease houseLease) {
		return iHouseLeaseClientVoService.deleteHouseLeaseClient(houseLease);
	}

}

